from EGStar.head import dervier
import time
import re
import datetime
import subprocess
import os

global standard, standardx, Output, Output_BLH, Input, Input_xyz, show, m, n
standardx = ['0.01', '0.00000001', '0.0001']
Output_BLH = ['editTextCoordinateOutputX', 'editTextCoordinateOutputY', 'EditTextCoordinateOutputH']
Output = ['EditTextOutputX', 'EditTextOutputY', 'EditTextCoordinateOutputH']
Input = ['editTextCoordinateInputX', 'editTextCoordinateInputY', 'EditTextCoordinateInputH']
Input_xyz = ['EditTextInputX', 'EditTextInputY', 'EditTextCoordinateInputH']

show = ['X', 'Y', 'Z']
X2_width = 0
X2_height = 0


def 经典界面():
    element = dervier.driver.find_element_by_id('android:id/action_bar_container')
    element.find_element_by_class_name('android.widget.ImageButton').click()
    dervier.driver.find_element_by_id('android:id/title').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvType').click()
    dervier.driver.find_element_by_name('经典风格').click()
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 通用界面():
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemUiSetting').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutUiType').click()
    dervier.driver.find_element_by_name('通用风格').click()
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 新建工程(str):
    projectname = dervier.driver.find_element_by_id('android:id/action_bar_title').text
    if projectname == str:
        return
    else:
        # 工程
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarProject').click()
        # 新建工程
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemNewProject').click()
        # 输入工程名
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtProjectName').send_keys(str)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
        # 输入坐标系名称
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem').send_keys(
            'CGCS2000')
        # 确定
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
        # 确定应用到工程
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()


def 演示模式():
    # 配置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
    # 仪器连接
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemBluetoothManager').click()
    try:
        dervier.driver.find_element_by_id('android:id/button1').click()
    except:
        pass
    # 连接方式 - 演示模式
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutDataLinkTypeSelect').click()
    # 演示模式
    dervier.driver.find_element_by_name('演示模式').click()
    # 输入坐标
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_1').send_keys('23.1053')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_2').send_keys('113.2501')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_3').send_keys('45')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_4').send_keys('-1')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_5').send_keys('-1')
    # 连接
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonBlueConnect').click()
    # 返回主界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 新建参数工程(project, system, parameter):
    # 工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarProject').click()
    # 新建工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemNewProject').click()
    # 输入工程名
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtProjectName').send_keys(project)
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # 坐标系统库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textviewCoordinateSystemList').click()
    dervier.driver.find_element_by_name(system).click()  # 输入坐标系名称
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem').send_keys(system)
    # 四参数
    if parameter == 0:
        # 打开四参数
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddFourParam').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseFourParam').click()
    # 七参数
    if parameter == 1:
        # 打开七参数
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddSevenParam').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseSevenParam').click()
    # 十参数
    if parameter == 2:
        # 打开十参数
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddSevenParam').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseSevenParam').click()
        # 切换模型
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewSettingMode').click()
        # 选择莫洛坚模型
        dervier.driver.find_element_by_name('莫洛坚模型').click()
        if __name__ == '__main__':
            dervier.swipeUp(dervier.driver, 2)
        m = 0
        molojan_id = ['textViewSevenValue_7', 'textViewSevenValue_8', 'textViewSevenValue_9']
        molojan_data = ['2564569', '446935', '45']
        for m in range(3):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + molojan_id[m]).send_keys(molojan_data[m])
    # 校正参数
    if parameter == 3:
        # 打开校正参数
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCorrectParam').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseCorrectionParam').click()
    # 高程拟合参数
    if parameter == 4:
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectHeightFittingParam').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
    # 垂直平差参数
    if parameter == 5:
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectVerBalanPar').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()

    # 确定使用参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    # 确定应用到工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()


def 新建坐标系统(name, ellipsoid):
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateSystemSetting').click()

    # 增加判断待新建的坐标系统是否已存在，存在先删除在新建
    # 获取坐标系统个数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxAll').click()
    text = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewNumber').text
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    text1 = re.findall(r"\d+\.?\d*", text)
    print(text1)
    m = int(text1[0]) // 9
    for i in range(m + 1):
        str = dervier.driver.page_source
        if name + '.sys' in str:
            # 删除
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
            dervier.driver.find_element_by_name(name + '.sys').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
        else:
            dervier.driver.swipe(500, 1036, 500, 218)

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barNewFile').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem').send_keys(name)
    # 选择目标椭球
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoorSysAddDestEllipsoid').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoorSysAddDestEllipsoid').click()
    dervier.driver.find_element_by_name(ellipsoid).click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btsure').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddProjectiveModeSetting').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextValue_2').send_keys('114')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()


def 调用Beijing54坐标系统():
    # 调用beijing54坐标系
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateSystemSetting').click()

    try:
        dervier.driver.find_element_by_name('BeiJing54a.sys').click()
    except:
        print('未找到Beijing54a')
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barNewFile').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem').send_keys(
            'BeiJing54a')
        # 选择目标椭球
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoorSysAddDestEllipsoid').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoorSysAddDestEllipsoid').click()
        dervier.driver.find_element_by_name('BJ54').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btsure').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()


def 配置坐标参数(System):
    # 配置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
    # 坐标系统库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateSystemSetting').click()
    # 选择 System
    dervier.driver.find_element_by_name(System).click()

    # 七参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddSevenParam').click()
    # 打开七参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseSevenParam').click()
    # 清空数据
    sevenpara_id = ['textViewSevenValue_0', 'textViewSevenValue_1', 'textViewSevenValue_2', 'textViewSevenValue_3',
                    'textViewSevenValue_4', 'textViewSevenValue_5', 'textViewSevenValue_6']
    sevenpara_data = ['61.473837', '14.228326', '21.588646', '0.32692256', '1.04493270', '-1.82981786', '17.32056339']
    m = 0
    for m in range(7):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + sevenpara_id[m]).send_keys(sevenpara_data[m])
    dervier.swipeDown(dervier.driver)
    # 关闭七参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseSevenParam').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 四参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddFourParam').click()
    # 打开四参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseFourParam').click()
    fourpara_id = ['textViewFourValue_0', 'textViewFourValue_1', 'textViewFourValue_2', 'textViewFourValue_3']
    fourpara_data = ['1.3604', '-0.6924', '0.00000470', '1']
    m = 0
    for m in range(4):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + fourpara_id[m]).send_keys(fourpara_data[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseFourParam').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 校正参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCorrectParam').click()
    # 打开校正参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseCorrectionParam').click()
    # 北 / 东偏移，高程清零
    correct_id = ['textViewCorrectValue_0', 'textViewCorrectValue_1', 'textViewCorrectValue_2']
    correct_data = ['3.448', '17.091', '-34.3325']
    m = 0
    for m in range(3):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + correct_id[m]).send_keys(correct_data[m])
    # 关闭校正参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseCorrectionParam').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 高程拟合参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectHeightFittingParam').click()
    # 打开高程拟合参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
    # A0 / 1 / 2 / 3 / 4 / 5，北偏移，值清零
    m = 0
    fitting_id = ['textViewSevenValue_0', 'textViewSevenValue_1', 'textViewSevenValue_2', 'textViewSevenValue_3',
                  'textViewSevenValue_4', 'textViewSevenValue_5', 'textViewSevenValue_6', 'textViewSevenValue_7']
    fitting_data = ['-0.014658', '-0.0000004479', '-0.0000030117', '0.00000000098', '0.00000000286', '-0.00000000171',
                    '2557791.817', '437587.364']
    for m in range(8):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + fitting_id[m]).send_keys(fitting_data[m])
    # 关闭高程拟合参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 垂直平差参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectVerBalanPar').click()
    # 打开垂直参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
    m = 0
    vertical_id = ['textViewSevenValue_0', 'textViewSevenValue_1', 'textViewSevenValue_2', 'textViewSevenValue_3',
                   'textViewSevenValue_4']
    vertical_data = ['-5.605', '7.285', '-20.617', '3277906.078', '490466.493']
    # 平差参数，北斜坡，东斜坡，北原点，东原点
    for m in range(5):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + vertical_id[m]).send_keys(vertical_data[m])
    # 关闭垂直平差参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/uISwitchCoorSysAddIsUseHeightFittingParam').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    # 确定应用到工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()


def 坐标转换工具():
    # 点击工具按钮
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 点击坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()
    # 点击坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()
    # 选择源文件为BLH
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceBLH').click()
    # 选择源文件为xyh
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioObjectXYH').click()
    # 输入源坐标
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextCoordinateInputX').send_keys('23.1')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextCoordinateInputY').send_keys('113.2')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextCoordinateInputH').send_keys('20')
    # 正向转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonForwardSolution').click()
    # 下滑
    dervier.swipeUp(dervier.driver, 1)


def 数据对比(standard, lei, n):
    for m in range(3):
        if n == 1:
            # 经纬度
            str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Output_BLH[m]).text
        else:
            # 平面坐标/空间坐标
            str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Output[m]).text

        if abs(float(str) - float(standard[m])) >= float(standardx[n]):
            print(lei + ' ' + show[m] + '数值不一致')
            print(str + ' ' + standard[m])
        else:
            print(lei + ' ' + show[m] + '正确')


def 坐标定位(x, y):
    X = dervier.driver.get_window_size()['width']
    Y = dervier.driver.get_window_size()['height']
    Kx = (x * X) / 720
    Ky = (y * Y) / 1190
    dervier.driver.tap([(Kx, Ky)])


def fast_input(str, element):
    # '快速输入'
    x = dervier.desired_caps['deviceName']
    print(x)
    element.click()
    # time.sleep(0.3)
    element.clear()
    # subprocess.Popen('adb -s %s shell input text %s' % (x, str), shell=True)
    adb1 = "adb shell ime set com.android.adbkeyboard/.AdbIME"
    os.system(adb1)
    adb2 = "adb shell am broadcast -a ADB_INPUT_TEXT --es msg '%s'" % str
    os.system(adb2)
    time.sleep(2)


# 工程
def 新建工程1():
    # 工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarProject').click()
    # 新建工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemNewProject').click()
    # 输入工程名
    # fast_input('777', dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtProjectName'))
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtProjectName').send_keys('测试1')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # 输入坐标系名称
    # fast_input('777', dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem'))
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem').send_keys('测试2')
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    # 确定应用到工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

def 退出软件():
    # 工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarProject').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemExist').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

# 配置 - 坐标系统参数
def CGCS2000坐标系统():
    新建工程('CGCS2000坐标系统')
    新建坐标系统('CGCS2000_1', 'CGCS2000')

    坐标转换工具()
    # 数据对比
    standard = ['2563151.355', '431734.774', '20.000']
    数据对比(standard, 'CGCS2000-', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    配置坐标参数('CGCS2000_1.sys')

    # 四参数
    新建参数工程('CGCS2000_4参数', 'CGCS2000_1.sys', 0)
    坐标转换工具()
    # 数据对比
    standard = ['2563152.617', '431734.665', '20.000']
    数据对比(standard, 'CGCS2000—4参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 七参数
    新建参数工程('CGCS2000_7参数', 'CGCS2000_1.sys', 1)
    坐标转换工具()
    standard = ['2563153.305', '431734.782', '128.482']
    数据对比(standard, 'CGCS2000—7参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 十参数
    新建参数工程('CGCS2000_10参数', 'CGCS2000_1.sys', 2)
    坐标转换工具()
    standard = ['2563146.497', '431783.977', '112.640']
    数据对比(standard, 'CGCS2000—10参数', 0)

    # 进行反算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonBackCalculation').click()
    # 数据对比
    standard = ['023.1000000017', '113.1959999955', '19.999']
    for m in range(3):
        if m < 2:
            str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Input[m]).text
            if abs(float(str) - float(standard[m])) >= float(standardx[1]):
                print('十参数' + show[m] + '数值不一致')
            else:
                print('十参数' + show[m] + '正确')
        else:
            str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Input[m]).text
            if abs(float(str) - float(standard[m])) >= float(standardx[0]):
                print('十参数' + show[m] + '数值不一致')
            else:
                print('十参数' + show[m] + '正确')
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 校正参数
    新建参数工程('CGCS2000_校正参数', 'CGCS2000_1.sys', 3)
    坐标转换工具()
    # 数据对比
    standard = ['2563154.803', '431751.865', '-14.332']
    数据对比(standard, 'CGCS2000—校正参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 高程拟合参数
    新建参数工程('CGCS2000_高程拟合参数', 'CGCS2000_1.sys', 4)
    坐标转换工具()
    # 数据对比
    standard = ['2563151.355', '431734.774', '19.820']
    数据对比(standard, 'CGCS2000—高程拟合参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 垂直平差参数
    新建参数工程('CGCS2000_垂直平差参数', 'CGCS2000_1.sys', 5)
    坐标转换工具()
    standard = ['2563151.355', '431734.774', '10.399']
    数据对比(standard, 'CGCS2000—垂直平差', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def XiAn80坐标系统():
    新建工程('XiAn80坐标系统')
    新建坐标系统('XiAn80', 'XIAN80')

    坐标转换工具()
    # 数据对比
    standard = ['2563152.567', '431734.742', '17.004']
    数据对比(standard, 'XiAn80-', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    配置坐标参数('XiAn80.sys')

    # 四参数
    新建参数工程('XiAn80_4参数', 'XiAn80.sys', 0)
    坐标转换工具()
    # 数据对比
    standard = ['2563153.829', '431734.633', '17.004']
    数据对比(standard, 'XiAn80—4参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 七参数
    新建参数工程('XiAn80_7参数', 'XiAn80.sys', 1)
    坐标转换工具()
    # 数据对比
    standard = ['2563154.518', '431734.750', '125.486']
    数据对比(standard, 'XiAn80—7参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 校正参数
    新建参数工程('XiAn80_校正参数', 'XiAn80.sys', 3)
    坐标转换工具()
    # 数据对比
    standard = ['2563156.015', '431751.833', '-17.328']
    数据对比(standard, 'XiAn80—校正参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 高程拟合参数
    新建参数工程('XiAn80_高程拟合参数', 'XiAn80.sys', 4)
    坐标转换工具()
    # 数据对比
    standard = ['2563152.567', '431734.742', '16.824']
    数据对比(standard, 'XiAn80—高程拟合参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def WGS84坐标系统():
    新建工程('WGS84坐标系统')
    新建坐标系统('WGS84_1', 'WGS84')

    坐标转换工具()
    # 数据对比
    standard = ['2563151.355', '431734.774', '20.000']
    数据对比(standard, 'WGS84-', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    配置坐标参数('WGS84_1.sys')

    # 四参数
    新建参数工程('WGS84_4参数', 'WGS84_1.sys', 0)
    坐标转换工具()
    # 数据对比
    standard = ['2563152.617', '431734.665', '20.000']
    数据对比(standard, 'WGS84—4参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 七参数
    新建参数工程('WGS84_7参数', 'WGS84_1.sys', 1)
    坐标转换工具()
    # 数据对比
    standard = ['2563153.305', '431734.782', '128.482']
    数据对比(standard, 'WGS84—7参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 校正参数
    新建参数工程('WGS84_校正参数', 'WGS84_1.sys', 3)
    坐标转换工具()
    # 数据对比
    standard = ['2563154.803', '431751.865', '-14.332']
    数据对比(standard, 'WGS84—校正参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 高程拟合参数
    新建参数工程('WGS84_高程拟合参数', 'WGS84_1.sys', 4)
    坐标转换工具()
    # 数据对比
    standard = ['2563151.355', '431734.774', '19.820']
    数据对比(standard, 'WGS84—高程拟合参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def BeiJing54坐标系统():
    新建工程('BeiJing54坐标系统')
    新建坐标系统('BeiJing54', 'BJ54')

    坐标转换工具()
    # 数据对比
    standard = ['2563195.083', '431733.614', '-88.417']
    数据对比(standard, 'BeiJing54', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    配置坐标参数('BeiJing54.sys')

    # 四参数
    新建参数工程('BeiJing54_4参数', 'BeiJing54.sys', 0)
    坐标转换工具()
    # 数据对比
    standard = ['2563196.345', '431733.506', '-88.417']
    数据对比(standard, 'BeiJing54—4参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 七参数
    新建参数工程('BeiJing54_7参数', 'BeiJing54.sys', 1)
    坐标转换工具()
    # 数据对比
    standard = ['2563197.033', '431733.622', '20.064']
    数据对比(standard, 'BeiJing54—7参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 校正参数
    新建参数工程('BeiJing54_校正参数', 'BeiJing54.sys', 3)
    坐标转换工具()
    # 数据对比
    standard = ['2563198.531', '431750.705', '-122.750']
    数据对比(standard, 'BeiJing54—校正参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 高程拟合参数
    新建参数工程('BeiJing54_高程拟合参数', 'BeiJing54.sys', 4)
    坐标转换工具()
    # 数据对比
    standard = ['2563195.083', '431733.614', '-88.599']
    数据对比(standard, 'BeiJing54—高程拟合参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 高斯投影():
    edittext = ['EditTextValue_0', 'EditTextValue_1', 'EditTextValue_2', 'EditTextValue_3', 'EditTextValue_4',
                'EditTextValue_5', ]
    entertext = ['1000', '-500000', '78', '0.0143545', '0.99993455', '10']
    entertext1 = ['0', '500000', '114', '0', '1', '0']
    lei = ['北偏移', '东偏移', '中央子午线', '基准纬度', '投影比例尺', '投影高']
    global standard
    # 工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarProject').click()
    # 新建工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemNewProject').click()
    # 输入工程名
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtProjectName').send_keys('高斯投影')
    # fast_input('高斯投影', dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtProjectName'))
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # 进入坐标系统管理库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textviewCoordinateSystemList').click()
    time.sleep(3)
    # 新建坐标系统
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barNewFile').click()
    # 坐标系统beijing54
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem').send_keys('高斯投影')
    # fast_input('高斯投影', dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem'))
    # 目标椭球
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LayoutProjectDestEllipsoid').click()
    # 椭球模板
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LayoutProjectDestEllipsoidMode').click()
    # BJ54
    dervier.driver.find_element_by_name('BJ54').click()
    # 确定椭球
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btsure').click()
    # 设置投影参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddProjectiveModeSetting').click()
    # 输入中央子午线
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextValue_2').send_keys('114')
    # fast_input('114', dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextValue_2'))
    # 确定参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    # 确定应用到工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    n = 0
    for n in range(6):
        if n == 0:
            # 北偏移x
            # 配置
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
            # 坐标系统设置
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateSystemSetting').click()
            # 选择高斯投影
            dervier.driver.find_element_by_name('高斯投影.sys').click()
            # 设置投影参数
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddProjectiveModeSetting').click()
            # 清空并输入北偏移
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + edittext[n]).send_keys(entertext[n])
            # fast_input(entertext[n], dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + edittext[n]))
            # 确定投影方式
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
            # 确定
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
            # 确定应用到工程
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

            坐标转换工具()
            # 数据对比
            if n == 0:
                standard = ['2564195.083', '431733.614', '-88.417']
                数据对比(standard, '高斯投影-' + lei[n], 0)
            # 退出坐标转换
            dervier.driver.find_element_by_id('android:id/action_bar_title').click()
        else:
            # 东偏移
            # 配置
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
            # 坐标系统设置
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateSystemSetting').click()
            # 选择高斯投影
            dervier.driver.find_element_by_name('高斯投影.sys').click()
            # 设置投影参数
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddProjectiveModeSetting').click()
            # 清空并输入东偏移
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + edittext[n - 1]).send_keys(
                entertext1[n - 1])
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + edittext[n]).send_keys(entertext[n])
            # 确定投影方式
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
            # 确定
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
            # 确定应用到工程
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

            坐标转换工具()
            # 数据对比
            if n == 1:
                standard = ['2563195.083', '-568266.386', '-88.417']
            if n == 2:
                standard = ['3066260.167', '4282484.155', '-88.417']
            if n == 3:
                standard = ['2560014.633', '431733.614', '-88.417']
            if n == 4:
                standard = ['2563027.322', '431738.082', '-88.417']
            if n == 5:
                standard = ['2563199.111', '431733.507', '-88.417']
            数据对比(standard, '高斯投影-' + lei[n], 0)

            if n == 5:
                # 反算
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonBackCalculation').click()
                # 数据对比
                standard = ['23.1000000008', '113.2000000015', '20']
                for m in range(3):
                    if m < 2:
                        str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Input[m]).text
                        if abs(float(str) - float(standard[m])) >= float(standardx[1]):
                            print('高斯投影-反算投影高' + show[m] + '数值不一致')
                        else:
                            print('高斯投影-反算投影高' + show[m] + '正确')
                    else:
                        str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Input[m]).text
                        if abs(float(str) - float(standard[m])) >= float(standardx[0]):
                            print('高斯投影-反算投影高' + show[m] + '数值不一致')
                        else:
                            print('高斯投影-反算投影高' + show[m] + '正确')
            # 退出坐标转换
            dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 一组参数
    i = 0
    # 配置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
    # 坐标系统设置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateSystemSetting').click()
    # 选择高斯投影
    dervier.driver.find_element_by_name('高斯投影.sys').click()
    # 设置投影参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddProjectiveModeSetting').click()
    # 清空并输入数据
    for i in range(6):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + edittext[i]).send_keys(entertext[i])
    # 确定投影方式
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    # 确定应用到工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    坐标转换工具()
    # 数据对比
    standard = ['3063884.052', '3282242.535', '-88.417']
    数据对比(standard, '高斯投影-一组参数', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def UTM():
    m = 0
    n = 0
    edittext = ['EditTextValue_0', 'EditTextValue_1', 'EditTextValue_2', 'EditTextValue_3', 'EditTextValue_4',
                'EditTextValue_5', ]
    entertext = ['1000', '-500000', '78', '0.0143545', '0.99993455', '10']
    global standard
    # 工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarProject').click()
    # 新建工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemNewProject').click()
    # 输入工程名
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtProjectName').send_keys('UTM')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # 进入坐标系统管理库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textviewCoordinateSystemList').click()
    # 新建坐标系统
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewButtonNewFile').click()
    # 坐标UTM投影
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectCoordinateSystem').send_keys('UTM')
    # 目标椭球
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LayoutProjectDestEllipsoid').click()
    # 椭球模板
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LayoutProjectDestEllipsoidMode').click()
    # BJ54
    dervier.driver.find_element_by_name('BJ54').click()
    # 确定椭球
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btsure').click()
    # 设置投影参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddProjectiveModeSetting').click()
    # 投影参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewCoorSysAddProjectiveMode').click()
    # 选择UTM
    dervier.driver.find_element_by_name('UTM投影').click()
    # 中央子午线
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextValue_2').send_keys('114')
    # 确定参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    # 确定应用到工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    坐标转换工具()
    # 数据对比
    standard = ['2562169.805', '431760.921', '-88.417']
    数据对比(standard, 'UTM默认-', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 一组参数
    # 配置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
    # 坐标系统设置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateSystemSetting').click()
    # 选择UTM
    dervier.driver.find_element_by_name('UTM.sys').click()
    # 设置投影参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ModifyProjectAddProjectiveModeSetting').click()
    # 投影所有参数
    for n in range(6):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + edittext[n]).send_keys(entertext[n])
    # 确定投影方式
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
    # 确定应用到工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    坐标转换工具()
    # 数据对比
    standard = ['3063884.052', '3282242.535', '-88.417']
    数据对比(standard, 'UTM一组参数-', 0)
    # 退出坐标转换
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 水准文件():
    print('水准文件')

    新建工程('水准文件')
    调用Beijing54坐标系统()
    type_name = ['双线性插值', '双二次插值', '样条插值', '特殊的加权插值']
    for m in range(4):
        # 配置
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
        # 坐标参数设置
        dervier.driver.find_element_by_id(
            'com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransformParameterSetting').click()
        # 水准模型计算方式
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewElvCaleType').click()
        # 选择类型
        dervier.driver.find_element_by_name(type_name[m]).click()
        # 下滑 - 选择文件
        dervier.swipeUp(dervier.driver, 1)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewElvGridModeFileName').click()
        # SGF格式
        if m == 0:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/stake_file_import_item_text').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
        # GGF格式
        else:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/spinnerFileType').click()
            dervier.driver.find_element_by_name('*.GGF').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/stake_file_import_item_text').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
        # 确定
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btcoorsyssure').click()
        # 确定应用到工程
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

        坐标转换工具()
        if m != 3:
            standard = ['2563195.083', '431733.614', '40.266']
        else:
            standard = ['2563195.083', '431733.614', '26.832']
        数据对比(standard, type_name[m], 0)
        # 退出坐标转换界面
        dervier.driver.find_element_by_id('android:id/action_bar_title').click()


# 配置 - 工程设置
def 工程设置():
    # 天线高
    新建工程('天线高')
    演示模式()

    # 配置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemProjectSetting').click()

    radio_id = ['radioStraigh', 'radioOblique', 'radioPole', 'radioSide']
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtAntennaHeight').send_keys('1.8')
    i = 0
    while i < len(radio_id):
        if i == 1:
            continue
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + radio_id).click()
        i += 1

    新建工程('测区范围')
    演示模式()

    NEH_id = ['textViewNoth', 'textViewEath', 'textViewControlCollectValue_3']
    NEH_data = [['100.2323', '200.2356', '45.125'], ['200.5645', '500.4586', '46.258'], ['450.259', '356.0214', '44.256']]
    point_name = ['输入点', '控制点', '测量点']

    for m in range(3):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys(point_name[m])
        for n in range(3):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[n]).send_keys(NEH_data[m][n])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewSpecifyPointTypeGet').click()
        dervier.driver.find_element_by_name(point_name[m]).click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 配置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarConfigure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemProjectSetting').click()

    dervier.driver.find_element_by_name('系统测试').click()
    dervier.swipeUp(dervier.driver, 2)

    # 测区范围 - 打开
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/UISwitchSurveyArea').click()

    # 测区范围设置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutSurveyAreaSetting').click()


# 输入（坐标管理库，求转换参数）
def 坐标管理库():
    新建工程('坐标管理库')
    演示模式()

    NEH_id = ['textViewNoth', 'textViewEath', 'textViewControlCollectValue_3']
    BLH_id = ['textViewControlCollectValue_1', 'textViewControlCollectValue_2', 'textViewControlCollectValue_3']
    NEH_data = ['100.2323', '200.2356', '45.125']
    BLH_data = ['23.5959111', '113.5959222', '45.335']
    point_name = ['输入点', '控制点', '测量点']

    # 测量-获取平滑点
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarMeasure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemPointSurvey').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/bottomBtn3').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
    time.sleep(7)
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys('平滑点')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonSurfaceSaveSure').click()
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # 坐标管理库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateManager').click()

    # 添加（平面坐标，经纬度坐标，输入点，控制点，测量点）
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # fast_input('平面坐标', dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName'))
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys('平面坐标')
    # fast_input('平面', dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCode'))
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCode').send_keys('平面')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceNEH').click()

    for m in range(3):
        # fast_input(NEH_data[m], dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[m]))
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[m]).send_keys(NEH_data[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # fast_input('经纬度', dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName'))
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys('经纬度')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceBLH').click()
    for m in range(3):
        # fast_input(BLH_data[m], dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + BLH_id[m]))
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + BLH_id[m]).send_keys(BLH_data[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    for m in range(3):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        # fast_input(point_name[m], dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName'))
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys(point_name[m])
        for n in range(3):
            # fast_input(NEH_data[n], dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[n]))
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[n]).send_keys(NEH_data[n])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewSpecifyPointTypeGet').click()
        dervier.driver.find_element_by_name(point_name[m]).click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 编辑功能
    dervier.driver.find_element_by_name('平滑点').click()
    dervier.driver.find_element_by_name('编辑').click()

    # 修改天线高
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_4').send_keys('5')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 导出功能
    expoet_type = ['Cass文件(东,北,高)(*.dat)', '测量原始数据(*.RTK)', '测量原始数据Result(*.RTK)', '测量成果数据(*.dat)', '测量过程数据(*.dat)',
                   'dxf文件-点名和坐标(*.dxf)', 'Google earth(*.kml)', '点放样文件(*.skp)', 'NCN(*.NCN)', 'dxf文件-高程(编码)(*.dxf)',
                   'android 交换格式(*.dat)', 'dxf文件-点名(*.dxf)']

    for m in range(len(expoet_type)):

        s = expoet_type[m]
        a = re.sub(u"\\(.*?\\)|\\{.*?\\}|\\[.*?\\]|\\<.*?\\>", "", s)

        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btExport').click()
        time.sleep(1)
        # fast_input(a, dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextExportFileName'))
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextExportFileName').send_keys(a)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/spinnerFileType').click()
        if m > 7:
            dervier.swipeUp(dervier.driver, 1)
        dervier.driver.find_element_by_name(expoet_type[m]).click()
        print(expoet_type[m])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
        time.sleep(2)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()

    # # 导出数据 - 自定义文件类型（csv, dat, txt）
    # custom_tp = ['自定义文件类型', '测量过程数据自定义']
    # suffix = ['csv', 'txt', 'dat']
    # angle = ['ddd.dddddddd', 'ddd.mmssssss', 'ddd:mm:ssssss']
    # for p in range(len(custom_tp)):
    #     for m in range(len(suffix)):
    #         for n in range(len(angle)):
    #             # print(custom_tp[p] + '_' + suffix[m] + '_' + angle[n])
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btExport').click()
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextExportFileName').send_keys(
    #                 custom_tp[p] + '(' + suffix[m] + ')')
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/spinnerFileType').click()
    #             if p == 1:
    #                 dervier.swipeUp(dervier.driver, 1)
    #                 dervier.driver.find_elements_by_id('android:id/text1')[7].click()
    #             else:
    #                 dervier.driver.find_elements_by_id('android:id/text1')[8].click()
    #             # 编辑
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnEdit').click()
    #             if n == 0:
    #                 # 后缀名
    #                 dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewExtensions').click()
    #                 dervier.driver.find_element_by_name(suffix[m]).click()
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewAngleFormat').click()
    #             dervier.driver.find_element_by_name(angle[n]).click()
    #             dervier.swipeUp(dervier.driver, 1)
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxSelectAll').click()
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    #             dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()


    # 导入功能
    import_type = ['*.dat-Pn,x,y,h,Pc', '*.dat-Pn,Pc,y,x,h (南方 cass)', '*.dat-Mobile3.0', '*.RTK-Mobile3.0',
                   '*.txt-Pn,x,y,h,Pc', '*.txt-Pn,B,L,H,Pc(ddd.mmssssss)', '*.txt-Pn,B,L,H,Pc(ddd.dddddddd)',
                   '*.xyh-电力之星道亨成果点', '*.NCN-Pn,y,x,h', '*.dat-Android 交换格式']

    for i in range(len(import_type)):
        total = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewShowNumsRecord').text
        a = re.sub(r"[(\D)]", "", total)
        # 导入
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btImport').click()
        # 选择AAA坐标管理库文件夹
        dervier.driver.find_element_by_name('AAA坐标管理库').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/spinnerFileType').click()
        # 通过相同id的索引定位
        dervier.driver.find_elements_by_id('android:id/text1')[i].click()
        b = re.findall(r"\*(.*)-", import_type[i])
        dervier.driver.find_element_by_name(str(i + 1) + b[0]).click()
        time.sleep(3)
        total1 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewShowNumsRecord').text
        c = re.sub(r"[(\D)]", "", total1)

        if (int(c) - int(a)) != 3:
            print(import_type[i] + '导入失败')

    # 删除功能
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # 测量点，J1，d1
    dervier.driver.find_element_by_name('测量点').click()
    dervier.driver.find_element_by_name('J1').click()
    dervier.driver.find_element_by_name('d1').click()
    # 点击删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    total = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewShowNumsRecord').text
    d = re.sub(r"[(\D)]", "", total)
    if (int(d)) != 33:
        print('删除失败')

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # 全选
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxAll').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    total = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewShowNumsRecord').text
    d = re.sub(r"[(\D)]", "", total)
    if (int(d)) != 0:
        print('全部删除失败')


def 求转换参数():
    type_name = ['加权平均', '平面拟合', '曲面拟合', '自动判断']

    新建工程('求转换参数')
    调用Beijing54坐标系统()

    # # 3组参数一步法
    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # 求转换参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemTransformParameter').click()

    # 添加数据
    point_id = ['EditTextPointName', 'EditTextCoordinateLeavelN', 'EditTextCoordinateLeavelE',
                'EditTextCoordinateLeavelH', 'editTextCoordinateGroundB', 'editTextCoordinateGroundL',
                'EditTextCoordinateGroundH']
    point_data = [['1', '2555835.812', '435611.940', '-2.609', '23.0601289173', '113.2217456428', '-2.609'],
                  ['2', '2561768.909', '436534.853', '9.651', '23.0914269181', '113.2248999623', '9.651'],
                  ['3', '2556110.325', '440584.616', '-2.761', '23.0610880999', '113.2512146599', '-2.761']]

    for m in range(len(point_data)):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        for n in range(len(point_data[0])):
            dervier.driver.find_element_by_id(point_id[n]).send_keys(point_data[m][n])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    for q in range(len(type_name)):
        # 设置
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemSetting').click()
        # 坐标转换方法
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordTransform').click()
        # 一步法
        dervier.driver.find_element_by_name('一步法').click()
        # 高程选项
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutHeightFitting').click()
        # 加权平均
        dervier.driver.find_element_by_name(type_name[q]).click()
        # 确定
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
        # 计算
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
        # 确定计算结果
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
        # 应用
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btApply').click()
        # 确定应用到当前工程
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
        if q != 2:
            坐标转换工具()
            # 获取结果，并与工程之星3.0数据结果对比(加权，平面，自动3者结果一致)
            standard = ['2563197.034', '431733.624', '20']
            数据对比(standard, '3组数据' + type_name[q], 0)
            # 退出坐标转换界面
            dervier.driver.find_element_by_id('android:id/action_bar_title').click()
        # 输入
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
        # 求转换参数
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemTransformParameter').click()

    # 6组参数一步法

    # 添加数据
    point1_data = [['4', '2556976.734', '438434.841', '-1.810', '23.0638760666', '113.2356481451', '-1.800'],
                   ['5', '2560227.772', '438732.603', '1.506', '23.0824473918', '113.2406476436', '1.506'],
                   ['6', '2555831.347', '435625.333', '-2.390', '23.0601145914', '113.2217927701', '-2.390']]
    for m in range(0, 3):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        for n in range(7):
            dervier.driver.find_element_by_id(point_id[n]).send_keys(point1_data[m][n])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    for q in range(4):
        # 设置
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemSetting').click()
        # 坐标转换方法
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordTransform').click()
        # 一步法
        dervier.driver.find_element_by_name('一步法').click()
        # 高程选项
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutHeightFitting').click()
        # 加权平均
        dervier.driver.find_element_by_name(type_name[q]).click()
        # 确定
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
        # 计算
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
        # 确定计算结果
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
        # 应用
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btApply').click()
        # 确定应用到当前工程
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
        if q != 2:
            坐标转换工具()
            # 获取结果，并与工程之星3.0数据结果对比(平面，自动2者结果一致)
            if q == 0:
                standard = ['2563197.035', '431733.625', '19.988']
            else:
                standard = ['2563197.035', '431733.625', '20.002']
            数据对比(standard, '6组数据' + type_name[q], 0)
            # 退出坐标转换界面
            dervier.driver.find_element_by_id('android:id/action_bar_title').click()
        # 输入
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
        # 求转换参数
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemTransformParameter').click()

    # 6组参数七参数法
    # 设置
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemSetting').click()
    # 坐标转换方法
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordTransform').click()
    # 七参数
    dervier.driver.find_element_by_name('七参数').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
    # 确定计算结果
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # 应用
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btApply').click()
    # 确定应用到当前工程
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    坐标转换工具()
    standard = ['2563197.033', '431733.622', '20.002']
    数据对比(standard, '6组数据七参数', 0)
    # 退出坐标转换界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 7组参数二步法+残差
    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # 求转换参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemTransformParameter').click()

    # 添加数据
    point1_data = ['7', '2555840.347', '435633.333', '-2.5', '23.0701145914', '113.2317927701', '-2.5']
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    for n in range(7):
        dervier.driver.find_element_by_id(point_id[n]).send_keys(point1_data[n])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    for q in range(4):
        # 设置
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemSetting').click()
        # 坐标转换方法
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordTransform').click()
        # 二步法
        dervier.driver.find_element_by_name('二步法').click()
        # 高程选项
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutHeightFitting').click()
        dervier.driver.find_element_by_name(type_name[q]).click()
        if q == 0:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxUseDifference').click()
        # 确定
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
        # 计算
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
        # 确定计算结果
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
        try:
            # 应用
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btApply').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
            # 确定应用到当前工程
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
        except:
            # 应用
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btApply').click()
            # 确定应用到当前工程
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

        坐标转换工具()
        # 获取结果，并与工程之星3.0数据结果对比(曲面，自动2者结果一致)
        if q == 0:
            standard = ['2562969.347', '431407.526', '20.643']
        elif q == 1:
            standard = ['2562969.347', '431407.526', '20.214']
        else:
            standard = ['2562969.347', '431407.526', '-29.220']
        数据对比(standard, '7组数据' + type_name[q], 0)
        # 退出坐标转换界面
        dervier.driver.find_element_by_id('android:id/action_bar_title').click()
        # 输入
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
        # 求转换参数
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemTransformParameter').click()


def 校正向导():
    新建工程('校正向导')
    演示模式()

    point_name = ['平面坐标', '经纬度坐标']
    NEH_id = ['textViewNoth', 'textViewEath', 'textViewControlCollectValue_3']
    BLH_id = ['textViewControlCollectValue_1', 'textViewControlCollectValue_2', 'textViewControlCollectValue_3']
    NEH_data = ['1000.23', '2000.23', '55.125']
    BLH_data = ['23.1053', '113.2501', '45']

    # 坐标管理库 - 添加点
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateManager').click()
    for i in range(len(point_name)):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys(point_name[i])
        for m in range(0, len(NEH_data)):
            if i == 1:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceBLH').click()
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + BLH_id[m]).send_keys(BLH_data[m])
            else:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[m]).send_keys(NEH_data[m])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCorrectionWizard').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()

    point_id = ['edtPointName', 'editTextDestCoorX', 'editTextDestCoorY', 'editTextDestCoorH']
    point_data = ['校正点', '2564705.091', '440304.723', '16.464']

    # 判断经纬度坐标是否勾选，勾选将去掉
    try:
        element = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutSourse')
        element.find_element_by_class_name('android.widget.ImageView').click()
        dervier.driver.find_element_by_name('经纬度坐标').click()
    except:
        # 手动输入
        for i in range(len(point_id)):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_id[i]).send_keys(point_data[i])

        # 天线高
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtAntennaHeight').send_keys('1.8')

        # 量取类型(直高，测片高，杆高)
        antenna_type = ['radioStraigh', 'radioSide', 'radioPole']
        for i in range(len(antenna_type)):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + antenna_type[i]).click()

        # 平滑采集
        dervier.swipeUp(dervier.driver, 1)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkSmoothCollect').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnCorrect').click()
        time.sleep(7)

        # 对比数据
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarMeasure').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemPointSurvey').click()

        NEH_id = ['textViewBottom2', 'textViewBottom3', 'textViewBottom4']
        for i in range(len(NEH_id)):
            NEH_data1 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[i]).text
            if abs(float(NEH_data1) - float(point_data[i + 1])) > 0.01:
                print('校正失败' + NEH_data1)
        dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCorrectionWizard').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()

    # 点库获取 - 经纬度模式
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutObject').click()
    dervier.driver.find_element_by_name('平面坐标').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBox').click()

    element = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutSourse')
    try:
        element.find_element_by_class_name('android.widget.ImageView').click()
        dervier.driver.find_element_by_name('经纬度坐标').click()
    except:
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBox').click()
        element.find_element_by_class_name('android.widget.ImageView').click()

    dervier.driver.find_element_by_name('经纬度坐标').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
    dervier.swipeUp(dervier.driver, 1)

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnCorrect').click()

    # 对比数据
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarMeasure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemPointSurvey').click()

    NEH_id = ['textViewBottom2', 'textViewBottom3', 'textViewBottom4']
    NEH_data3 = ['1000.168', '2000.287', '47.825']
    for i in range(len(NEH_id)):
        NEH_data2 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[i]).text
        if abs(float(NEH_data2) - float(NEH_data3[i])) > 0.01:
            print('校正失败' + NEH_data2)
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCorrectionWizard').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBox').click()


# 道路设计
def 道路交点法():
    i = 0
    m = 0
    road_coordinate = [['2838951.660', '646721.193'], ['2838989.399', '646377.075'], ['2838828.262', '645180.064']]
    road_id = ['textViewControlCollectValue_1', 'textViewControlCollectValue_2', 'textViewIntersectItemInfoA1',
               'textViewIntersectItemInfoRadius', 'textViewIntersectItemInfoA2', 'textViewIntersectItemInfoStartRadius',
               'textViewIntersectItemInfoEndRadius']
    insert_data = ['2838950', '646721', '120', '650', '130', '10', '20']

    # 新建工程('交点法')
    # 演示模式()

    # # 输入 - 坐标管理库
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateManager').click()
    # # 添加
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # # 输入
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys('交点x')
    # # 选择xyz
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceNEH').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewNoth').send_keys('2838800')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEath').send_keys('645182')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_3').send_keys('10')
    # # 确定
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # # 返回主界面
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # # ----------------平曲线设计（里程0-1553）-----------------------
    # # 输入
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # # 道路设计
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemRoadDesign').click()
    # # 新建道路文件
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barNewFile').click()
    # # 道路名称
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtFileName').send_keys('1交点法')
    # # 平曲线设计
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutRoadDesignHorizontalCurve').click()
    # # 选择交点法
    # dervier.driver.find_element_by_name('交点法').click()
    # for i in range(3):
    #     # 添加数据
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    #     for m in range(2):
    #         # 输入数据
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + road_id[m]).send_keys(road_coordinate[i][m])
    #
    #     # 第二个交点输入缓曲参数
    #     if i == 1:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewIntersectItemInfoA1').send_keys(
    #             '80.000')
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewIntersectItemInfoRadius').send_keys(
    #             '700.000')
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewIntersectItemInfoA2').send_keys(
    #             '80.000')
    #     # 确定
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonSure').click()
    # # 确定平曲线
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # # 保存
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSave').click()
    # # 选择1交点法道路文件
    # dervier.driver.find_element_by_name('1交点法.road').click()
    # # 平曲线设计
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutRoadDesignHorizontalCurve').click()
    # # 修改交点名称
    # dervier.driver.find_element_by_name('Pt2').click()
    # dervier.driver.find_element_by_name('编辑').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewIntersectionName').send_keys('交点2')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonSure').click()
    # # 添加 - 定位获取
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LayoutExternalobtain').click()
    # dervier.driver.find_element_by_name('定位获取').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewIntersectionName').send_keys('定位点')
    #
    # standard = ['2564745.050', '440303.178']
    # standard1 = [0.01]
    #
    # # 选择交点2
    # OutputX = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_1').text
    # OutputY = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_2').text
    #
    # if abs(float(standard[0]) - (float(OutputX[0])) <= standard1[0]):
    #     if abs(float(standard[1]) - (float(OutputY[0])) >= standard1[0]):
    #         print('交点2东坐标定位获取不成功')
    # else:
    #     print('交点2北坐标定位获取不成功')
    #
    # # 确定
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonSure').click()
    # # 插入功能
    # dervier.driver.find_element_by_name('定位点').click()
    # dervier.driver.find_element_by_name('增加').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewIntersectionName').send_keys('插入点')
    # for i in range(7):
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + road_id[i]).send_keys(insert_data[i])
    # # 确定
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonSure').click()
    # # 添加 - 点库获取
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewIntersectionName').send_keys('点库点')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LayoutExternalobtain').click()
    # dervier.driver.find_element_by_name('点库获取').click()
    # dervier.driver.find_element_by_name('交点x').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
    # # 第一缓曲起点半径 - 无穷大
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxStart').click()
    # # 第二缓曲起点半径 - 无穷大
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxEnd').click()
    # # 确定
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonSure').click()
    # # 编辑交点
    # dervier.driver.find_element_by_name('定位点').click()
    # dervier.driver.find_element_by_name('编辑').click()
    #
    # location_data = ['90', '80', '70', '60', '50', '40', '30']
    # for i in range(len(road_id)):
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + road_id[i]).send_keys(location_data[i])
    # # 确定
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonSure').click()
    #
    # # 多选-删除
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # dervier.driver.find_element_by_name('定位点').click()
    # dervier.driver.find_element_by_name('点库点').click()
    # dervier.driver.find_element_by_name('插入点').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # # 设置-整桩号
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemSetting').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioNumber').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_1').send_keys('3')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_2').send_keys('6')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # # 查看
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
    # # 逐桩坐标 - 导出
    # dervier.driver.find_element_by_name('逐桩坐标').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemExport').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextExportFileName').send_keys('整桩号')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # # 返回
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    # # 设置-整桩距
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemSetting').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioDistance').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_1').send_keys('3')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewControlCollectValue_2').send_keys('6')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # # 查看
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
    # # 逐桩坐标
    # dervier.driver.find_element_by_name('逐桩坐标').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemExport').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextExportFileName').send_keys('整桩距')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # # 返回
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    # # 确定平曲线
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    #
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    # try:
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # except:
    #     pass
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # ---------------断链------------------
    # # 输入
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # # 道路设计
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemRoadDesign').click()
    # dervier.driver.find_element_by_name('1交点法.road').click()
    #
    # # 断链
    # broken_id = ['textViewControlCollectValue_1', 'textViewControlCollectValue_2']
    # broken_data = [['100', '200'], ['500', '450'], ['800', '900']]
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutRoadDesignBrokenChain').click()
    # for m in range(3):
    #     # 添加
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barADD').click()
    #     for n in range(2):
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + broken_id[n]).send_keys(broken_data[m][n])
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 编辑
    # dervier.driver.find_element_by_name('800.000').click()
    # dervier.driver.find_element_by_name('编辑').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + broken_id[0]).send_keys('1100')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + broken_id[1]).send_keys('1200')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 删除
    # for m in range(2):
    #     dervier.driver.find_element_by_name('100.000').click()
    #     dervier.driver.find_element_by_name('删除').click()
    #     if m == 0:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    #     else:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 多选 - 全删
    # for m in range(2):
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxAll').click()
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    #     if m == 0:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    #     else:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 退出断链界面
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    #
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    # try:
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # except:
    #     pass
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # ----------------纵曲线设计--------------------------
    # # 输入
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # # 道路设计
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemRoadDesign').click()
    # dervier.driver.find_element_by_name('1交点法.road').click()
    #
    # # 纵曲线设计
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutRoadDesignVerticalCurve').click()
    #
    # vertical_id = ['textViewControlCollectValue_1', 'textViewControlCollectValue_2', 'textViewControlCollectValue_5']
    # vertical_data = [['0', '8.891', '0'], ['53.4', '8.336', '19825.959'], ['228.4', '7.461', '4905.405'],
    #                  ['343.4', '9.014', '6630.952'], ['523.4', '7.664', '4000'], ['668.4', '9.839', '3600']]
    #
    # for m in range(5):
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    #     for n in range(3):
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + vertical_id[n]).send_keys(
    #             vertical_data[m][n])
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 编辑
    # dervier.driver.find_element_by_name('343.400').click()
    # dervier.driver.find_element_by_name('编辑').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + vertical_id[0]).send_keys('345')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + vertical_id[1]).send_keys('9.035')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + vertical_id[2]).send_keys('6630')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 查看
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
    # dervier.swipeUp(dervier.driver, 1)
    # dervier.driver.find_element_by_name('图像显示').click()
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    #
    # # 删除
    # for m in range(2):
    #     dervier.driver.find_element_by_name('53.400').click()
    #     dervier.driver.find_element_by_name('删除').click()
    #     if m == 0:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    #     else:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 多选 - 全删
    # for m in range(2):
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxAll').click()
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    #     if m == 0:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    #     else:
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 退出纵断面界面
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    #
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    # try:
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # except:
    #     pass
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # ---------------标准横断面---------------
    # 输入
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # # 道路设计
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemRoadDesign').click()
    # dervier.driver.find_element_by_name('1交点法.road').click()
    #
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutRoadDesignCrossSection').click()
    #
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/ivArrow').click()
    # # dervier.driver.find_element_by_name('中央分隔带').click()
    # 坐标定位(385, 940)
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtWidth').send_keys('0.5')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtCrossSlope').send_keys('0')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtRoadTeeth').send_keys('0.3')
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # horizontal_id = ['edtName', 'edtWidth', 'edtCrossSlope', 'edtRoadTeeth']
    # horizontal_data = [['机动车道', '10', '-1.5', '-0.3'], ['分隔带', '1', '0', '0.2'], ['非机动车', '2', '1', '-0.2'],
    #                    ['绿化带', '1.2', '-0.5', '0.3']]
    #
    # for m in range(3):
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    #     for n in range(4):
    #         dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + horizontal_id[n]).send_keys(
    #             horizontal_data[m][n])
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 编辑
    # dervier.driver.find_element_by_name('分隔带').click()
    # dervier.driver.find_element_by_name('编辑').click()
    # for n in range(4):
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + horizontal_id[n]).send_keys(
    #         horizontal_data[3][n])
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 右断面 - 对称
    # dervier.driver.find_element_by_name('右断面').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemSymmetry').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/itemSymmetry').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # # 删除
    # dervier.driver.find_element_by_name('绿化带').click()
    # dervier.driver.find_element_by_name('删除').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    # dervier.driver.find_element_by_name('绿化带').click()
    # dervier.driver.find_element_by_name('删除').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    #
    # dervier.driver.find_element_by_name('左断面').click()
    # dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSave').click()
    #
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    # try:
    #     dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # except:
    #     pass
    # dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # ---------------------超高------------------------
    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # 道路设计
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemRoadDesign').click()
    dervier.driver.find_element_by_name('1交点法.road').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutRoadDesignSuperHigh').click()

    # 左侧板块 - 添加
    dervier.driver.find_element_by_id('android:id/text1').click()
    dervier.driver.find_element_by_name('机动车道').click()

    super_id = ['edtMileage', 'edtCrossSlope']
    super_data = [['10', '-1.5'], ['15', '-2'], ['20', '-2'], ['25', '-1.5'], ['22', '2.2'],['30', '1'], ['35', '0'], ['40', '0.5'],
                  ['45', '1']]

    for m in range(4):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        for n in range(0, 2):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + super_id[n]).send_keys(super_data[m][n])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    # 编辑
    dervier.driver.find_element_by_name('20.000').click()
    dervier.driver.find_element_by_name('编辑').click()
    for n in range(2):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + super_id[n]).send_keys(super_data[4][n])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()


    # 右侧板块
    dervier.driver.find_element_by_name('右侧板块').click()
    dervier.driver.find_element_by_id('android:id/text1').click()
    dervier.driver.find_element_by_name('非机动车').click()

    for m in range(5, 9):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        for n in range(2):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + super_id[n]).send_keys(super_data[m][n])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    # 删除
    dervier.driver.find_element_by_name('40.000').click()
    dervier.driver.find_element_by_name('删除').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    dervier.driver.find_element_by_name('40.000').click()
    dervier.driver.find_element_by_name('删除').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()


# 工具（坐标转换,计算四参数,计算七参数,计算坐标,计算方位角,间接测量,偏角偏距,偏点计算,夹角计算,角度换算,面积计算,空间计算，土方计算）
def 坐标转换():
    m = 0
    n = 0
    origin_id = ['radioRourceBLH', 'radioRourceXYZ', 'radioRourceXYH']
    destination_id = ['radioObjectBLH', 'radioObjectXYZ', 'radioObjectXYH']
    point = [['BLH -> BLH', 'BLH -> XYZ', 'BLH -> xyh'], ['XYZ -> BLH', 'XYZ -> XYZ', 'XYZ -> xyh'],
             ['xyh -> BLH', 'xyh -> XYZ', 'xyh -> xyh']]

    新建工程('坐标转换')
    新建坐标系统('BeiJing54', 'BJ54')

    # 点击工具按钮
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 点击坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()
    # 点击坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()

    for m in range(0, 3):
        dervier.swipeDown(dervier.driver, 1)
        if m == 2:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textviewSourceCoordinateSystem').click()
            dervier.driver.find_element_by_name('BeiJing54.sys').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + origin_id[m]).click()
        for n in range(3):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + destination_id[n]).click()
            # 输入源坐标
            if m == 0:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextCoordinateInputX').send_keys('23.1')
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextCoordinateInputY').send_keys(
                    '113.2')
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextCoordinateInputH').send_keys('20')
            elif m == 1:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextInputX').send_keys('-2323795.738')
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextInputY').send_keys('5387164.047')
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextCoordinateInputH').send_keys(
                    '2493751.377')
            else:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextInputX').send_keys('2563195.083')
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextInputY').send_keys('431733.614')
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EditTextCoordinateInputH').send_keys(
                    '-88.417')
            # 正向转换
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonForwardSolution').click()
            # 下滑
            dervier.swipeUp(dervier.driver, 1)

            if m == 0:
                if n == 0:
                    standard = ['+023.1000000002', '+113.20000000', '20.000']
                elif n == 1:
                    standard = ['-2323756.562', '5387073.229', '2493706.930']
                else:
                    standard = ['2563151.355', '431734.774', '20.000']
            elif m == 1:
                if n == 0:
                    standard = ['+023.1000063451', '+113.2000000013', '128.418']
                elif n == 1:
                    standard = ['-2323795.738', '5387164.047', '2493751.377']
                else:
                    standard = ['2563153.307', '431734.783', '128.418']
            else:
                if n == 0:
                    standard = ['+023.1000000006', '+113.2000000000', '20.000']
                elif n == 1:
                    standard = ['-2323756.562', '5387073.229', '2493706.930']
                else:
                    standard = ['2563151.355', '431734.774', '20.000']
            if n == 0:
                数据对比(standard, point[m][n], 1)
            else:
                数据对比(standard, point[m][n], 0)

    dervier.swipeDown(dervier.driver, 1)

    # --------------------反向转换 - --------------------
    # 源类型选择xyh
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceXYH').click()
    # 坐标系统选择坐标转换.sys
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textviewSourceCoordinateSystem').click()
    dervier.driver.find_element_by_name('BeiJing54.sys').click()
    # 目标类型选择BLH
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioObjectBLH').click()
    # 坐标系统选择WGS84.sys
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textviewObjectCoordinateSystem').click()
    dervier.driver.find_element_by_name('WGS84.sys').click()
    # 滑动到底部
    dervier.swipeUp(dervier.driver, 1)
    # 输入源坐标
    m = 0
    for m in range(3):
        output_data = ['23.1', '113.2', '20']
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Output_BLH[m]).send_keys(output_data[m])
    # 点击反向转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonBackCalculation').click()
    # 数据结果对比
    standard = ['2563195.083', '431733.614', '-88.417']
    m = 0
    for m in range(3):
        str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Input_xyz[m]).text
        if abs(float(str) - float(standard[m])) >= float(standardx[0]):
            print('反算' + show[m] + '数值不一致')
            print(str + ' ' + standard[m])
        else:
            print('反算' + show[m] + '正确')

    # 退出坐标转换界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 计算四参数():
    point_id = ['editTextCoordinateSrcX', 'editTextCoordinateSrcY', 'editTextCoordinateObjX', 'editTextCoordinateObjY']
    point = [['2555835.811', '435611.941', '2555835.812', '435611.940'],
             ['2561768.911', '436534.853', '2561768.909', '436534.853']]
    新建工程('计算四参数')
    演示模式()
    调用Beijing54坐标系统()

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()
    # 计算四参数
    坐标定位(450, 555)
    m = 0
    for m in range(2):
        # 添加数据1
        time.sleep(1)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        # 添加坐标
        n = 0
        for n in range(4):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_id[n]).send_keys(point[m][n])
        # 点击确定
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # 应用
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btApply').click()
    # 确定应用
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    坐标转换工具()

    standard = ['2563195.081', '431733.617', '-88.417']
    m = 0
    for m in range(3):
        str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + Output[m]).text
        if abs(float(str) - float(standard[m])) >= float(standardx[0]):
            print('计算四参数' + show[m] + '数值不一致')
            print(str + ' ' + standard[m])
        else:
            print('计算四参数' + show[m] + '正确')

    # 退出坐标转换界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # ------------多选-删除-全选-取消删除---------------
    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()
    # 计算四参数
    坐标定位(450, 555)
    time.sleep(1)
    # 添加数据
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 添加源坐标
    delete_data = ['2555565', '435611', '2555568.812', '435615']
    m = 0
    for m in range(4):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_id[m]).send_keys(delete_data[m])
    # 点击确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 多选
    dervier.driver.find_element_by_name('多选').click()
    # 选择3号点删除
    dervier.driver.find_element_by_name('3').click()
    # 删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # 确定删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # 多选
    dervier.driver.find_element_by_name('多选').click()
    # 全选
    dervier.driver.find_element_by_name('全选').click()
    # 取消全选
    dervier.driver.find_element_by_name('取消').click()
    # 多选
    dervier.driver.find_element_by_name('多选').click()
    # 全选
    dervier.driver.find_element_by_name('全选').click()
    # 删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # 确定删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # 返回主界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # ---------------点库获取---------------------
    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # 坐标管理库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateManager').click()

    # ---------------添加数据 -----------------
    point_id = ['textViewPointName', 'textViewCode', 'textViewNoth', 'textViewEath',
                'textViewControlCollectValue_3']
    point_data = [['四参1源坐标', '四参数', '2555835.811', '435611.941', '0'],
                  ['四参1目标坐标', '四参数', '2555835.812', '435611.940', '0'],
                  ['四参2源坐标', '四参数', '2561768.911', '436534.853', '0'],
                  ['四参2目标坐标', '四参数', '2561768.909', '436534.853', '0']]
    m = 0
    for m in range(4):
        n = 0
        # 添加
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        # 输入类型
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceNEH').click()
        for n in range(5):
            # 输入数据
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_id[n]).send_keys(point_data[m][n])
        # 确定
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 退出坐标管理库
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()
    # 计算四参数
    坐标定位(450, 555)
    # 添加数据
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 源坐标更多获取方式
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutSourse').click()
    # 点库获取
    dervier.driver.find_element_by_name('点库获取').click()
    # 选择四参1源坐标
    dervier.driver.find_element_by_name('四参1源坐标').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
    # 目标坐标更多
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutObject').click()
    # 点库获取
    dervier.driver.find_element_by_name('点库获取').click()
    # 选择四参1源坐标
    dervier.driver.find_element_by_name('四参1目标坐标').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 添加数据
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 源坐标更多获取方式
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutSourse').click()
    # 点库获取
    dervier.driver.find_element_by_name('点库获取').click()
    # 选择四参2源坐标
    dervier.driver.find_element_by_name('四参2源坐标').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
    # 目标坐标更多
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutObject').click()
    # 点库获取
    dervier.driver.find_element_by_name('点库获取').click()
    # 选择四参2源坐标
    dervier.driver.find_element_by_name('四参2目标坐标').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 添加数据
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 源坐标更多获取方式
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutSourse').click()
    # 定位获取
    dervier.driver.find_element_by_name('定位获取').click()
    # 目标坐标更多
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutObject').click()
    # 定位获取
    dervier.driver.find_element_by_name('定位获取').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 返回主界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 计算七参数():
    print('2')

    新建工程('计算七参数')
    调用Beijing54坐标系统()

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()
    # 计算七参数
    坐标定位(450, 590)

    point_id = ['editTextCoordinateGroundB', 'editTextCoordinateGroundL', 'EditTextCoordinateGroundH',
                'EditTextCoordinateLeavelN', 'EditTextCoordinateLeavelE', 'EditTextCoordinateLeavelH']
    point_data = [['23.0601289173', '113.2217456429', '-2.6090', '2555835.8120', '435611.9400', '-2.6090'],
                  ['23.0914269181', '113.2248999623', '9.6510', '2561768.9090', '436534.8530', '9.6510'],
                  ['23.0610880999', '113.2512146599', '-2.7610', '2556110.3250', '440584.6160', '-2.7610']]

    # 添加数据
    for m in range(3):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        # 大地坐标
        for n in range(6):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_id[n]).send_keys(point_data[m][n])
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCaculate').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # 应用
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btApply').click()
    # 确定应用
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # / *------使用坐标转换进行验证 - ------------ * /
    坐标转换工具()
    standard = ['2563197.033', '431733.622', '20']
    数据对比(standard, '计算七参数', 0)

    # 退出坐标转换界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # / * ------------多选-删除-全选-取消删除--------------- * /
    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 坐标转换
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateTransform1').click()
    # 计算七参数
    坐标定位(450, 590)

    # 添加数据
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    point_del_id = ['editTextCoordinateGroundB', 'editTextCoordinateGroundL', 'EditTextCoordinateGroundH',
                    'EditTextCoordinateLeavelN', 'EditTextCoordinateLeavelE', 'EditTextCoordinateLeavelH']
    point_del_data = ['23.06', '113.25', '-2.7', '2556110', '440584', '-2.7']
    for m in range(6):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_del_id[m]).send_keys(point_del_data[m])
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 多选
    dervier.driver.find_element_by_name('多选').click()
    # 选择3号点删除
    dervier.driver.find_element_by_name('3').click()
    # 删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # 确定删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # 多选
    dervier.driver.find_element_by_name('多选').click()
    # 全选
    dervier.driver.find_element_by_name('全选').click()
    # 取消全选
    dervier.driver.find_element_by_name('取消').click()
    # 多选
    dervier.driver.find_element_by_name('多选').click()
    # 全选
    dervier.driver.find_element_by_name('全选').click()
    # 删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # 确定删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # 返回主界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 计算坐标():
    新建工程('计算坐标')
    调用Beijing54坐标系统()

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 坐标计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateCalculate').click()
    # 计算坐标
    坐标定位(420, 510)
    # 输入坐标
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_1').send_keys('2558752.951')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_2').send_keys('435013.361')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_3').send_keys('24.063')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_7').send_keys('10')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_8').send_keys('1')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_9').send_keys('22')

    # 计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonCaculate').click()

    str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
    str1 = str.replace('\n', '').replace('\r', '')

    standard = '起点: 2558752.951,435013.361, 24.063方位 10.00000000距离(m): 1.000高差 22.000成果 2558753.936, 435013.535, 46.063'

    if str1 == standard:
        print('计算坐标通过')
    else:
        print('计算坐标计算失败')
        print(str1)

    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 计算方位角():
    新建工程('计算方位角')
    调用Beijing54坐标系统()

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 坐标计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateCalculate').click()
    # 计算方位角
    坐标定位(450, 590)
    # 输入坐标
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_1').send_keys('2558752')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_2').send_keys('435013')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_3').send_keys('24')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_4').send_keys('2558799')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_5').send_keys('435060')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_6').send_keys('12')

    # 计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonCaculate').click()

    str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
    str1 = str.replace('\n', '').replace('\r', '')
    standard = '平距(m): 66.468空间距离(m): 67.539高差(m): -12.000方位角: +045.00000000中点: 2558775.500, 435036.500, 18.000'
    if str1 == standard:
        print('计算方位角正确')
    else:
        print('计算方位角失败')
        print(str1)

    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 间接测量():
    def 间接测量数据对比(standard, name):
        # 计算
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonIndirectSurveyCaculate').click()
        str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewIndirectSurveyResult').text
        str1 = str.replace('\n', '').replace('\r', '')
        if str1 == standard:
            print(name + '计算正确')
        else:
            print(name + '计算失败')
        dervier.swipeDown(dervier.driver)

    新建工程('间接测量')
    # 工具 - 坐标计算 - 间接测量
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateCalculate').click()
    坐标定位(450, 660)

    # 一点线角法
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewIndirectSurveyMethodShow').click()
    dervier.driver.find_element_by_name('一点线角法(线向推导)').click()

    # 输入点坐标
    m = 0
    cogo_id = ['TextViewPointA1', 'TextViewPointA2', 'TextViewPointA3', 'editTextPointAngleAlpha', 'editTextPointLine',
               'editTextPointLineH']
    cogo_data = ['3', '2', '1', '90', '5', '8']
    for m in range(6):
        if m == 3:
            dervier.swipeUp(dervier.driver, 1)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + cogo_id[m]).send_keys(cogo_data[m])

    standard = 'N:3.000E:7.000H:9.000'
    间接测量数据对比(standard, '一点线角法')

    # 两点两线法
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewIndirectSurveyMethodShow').click()
    dervier.driver.find_element_by_name('两点两线法').click()
    cogo_id = ['TextViewCoordrA1', 'TextViewCoordrA2', 'TextViewCoordrA3', 'editTextLine1', 'editTextLine2',
               'TextViewCoordrB1', 'TextViewCoordrB2', 'TextViewCoordrB3']
    cogo_data = ['1', '1', '0', '2', '2', '4', '1', '0']
    m = 0
    for m in range(8):
        if m == 5:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewPointB').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + cogo_id[m]).send_keys(cogo_data[m])

    standard = 'N:2.500E:2.323H:0.000'
    间接测量数据对比(standard, '两点两线法')

    # 两点两角法
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewIndirectSurveyMethodShow').click()
    dervier.driver.find_element_by_name('两点两角法').click()

    cogo_id = ['TextViewCoordrA1', 'TextViewCoordrA2', 'TextViewCoordrA3', 'editTextAngle1', 'editTextAngle2',
               'TextViewCoordrB1', 'TextViewCoordrB2', 'TextViewCoordrB3']
    cogo_data = ['0', '1', '0', '30', '60', '0', '6', '0']
    m = 0
    for m in range(8):
        if m == 5:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewPointB').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + cogo_id[m]).send_keys(cogo_data[m])
    standard = 'N:2.165E:4.750H:0.000'
    间接测量数据对比(standard, '两点两角法')

    # 三点圆心法
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewIndirectSurveyMethodShow').click()
    dervier.driver.find_element_by_name('三点圆心法').click()
    cogo_id = ['TextViewCoordrA1', 'TextViewCoordrA2', 'TextViewCoordrA3', 'TextViewCoordrB1', 'TextViewCoordrB2',
               'TextViewCoordrB3', 'TextViewCoordrC1', 'TextViewCoordrC2', 'TextViewCoordrC3']
    cogo_data = ['1', '1', '0', '1', '7', '0', '4', '4', '0']
    m = 0
    for m in range(9):
        if m == 3:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewPointB').click()
        if m == 6:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewPointC').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + cogo_id[m]).send_keys(cogo_data[m])

    standard = 'N:1.000E:4.000H:0.000'
    间接测量数据对比(standard, '三点圆心法')

    # 两点线角法
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewIndirectSurveyMethodShow').click()
    dervier.driver.find_element_by_name('两点线角法').click()
    cogo_id = ['TextViewCoordrA1', 'TextViewCoordrA2', 'TextViewCoordrA3', 'TextViewCoordrB1', 'TextViewCoordrB2',
               'TextViewCoordrB3', 'editTextAngle1', 'editTextLine2']
    cogo_data = ['1', '1', '0', '2', '2', '0', '45', '5']
    m = 0
    for m in range(8):
        if m == 3:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewPointB').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + cogo_id[m]).send_keys(cogo_data[m])

    standard = 'N:2.000E:7.000H:0.000'
    间接测量数据对比(standard, '两点线角法')

    # 两线相交法
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewIndirectSurveyMethodShow').click()
    dervier.driver.find_element_by_name('两线相交法').click()
    cogo_id = ['TextViewCoordrA1', 'TextViewCoordrA2', 'TextViewCoordrA3', 'TextViewCoordrB1', 'TextViewCoordrB2',
               'TextViewCoordrB3', 'TextViewCoordrC1', 'TextViewCoordrC2', 'TextViewCoordrC3', 'TextViewCoordrD1',
               'TextViewCoordrD2', 'TextViewCoordrD3']
    cogo_data = ['1', '0', '0', '-1', '2', '0', '1', '2', '0', '-1', '0', '0']
    m = 0
    for m in range(12):
        if m == 3:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewPointB').click()
        if m == 6:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewPointC').click()
        if m == 9:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/TextViewPointD').click()
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + cogo_id[m]).send_keys(cogo_data[m])

    standard = 'N:0.000E:1.000H:0.000'
    间接测量数据对比(standard, '两线相交法')

    # 退出间接测量
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 偏角偏距():
    print('3')

    def 计算结果(standard):
        # 计算
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnCalculate').click()
        str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
        str1 = str.replace('\n', '').replace('\r', '')
        if (str1 == standard):
            print('计算正确')
        else:
            print('计算错误')
            print(str1)
        dervier.driver.find_element_by_name('数据输入').click()

    新建工程('偏角偏距')
    演示模式()

    # 输入 - 坐标管理库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateManager').click()
    # 添加
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 清空 - 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys('起终偏点')
    # 选择BLH
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceNEH').click()
    point_id = ['textViewNoth', 'textViewEath', 'textViewControlCollectValue_3']
    point_data = ['2565288.805', '440602.163', '45']
    for m in range(3):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_id[m]).send_keys(point_data[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 返回主界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 工具 - 偏点偏距
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateCalculate').click()
    坐标定位(450, 778)

    type_name = ['手动输入', '定位获取', '点库获取']
    standard = [
        '起点坐标: 2564745.050, 440303.178终点坐标: 2564788.805, 440802.163偏点坐标: 2565288.805, 440602.163计算结果起点距离(垂距): 345.341终点距离（垂距）: 155.559偏移距: 515.559偏转角:左偏 +106.47242697',
        '起点坐标: 2565288.805, 440602.163终点坐标: 2564788.805, 440802.163偏点坐标: 2564745.050, 440303.178计算结果起点距离(垂距): 393.824终点距离（垂距）: 144.693偏移距: 479.546偏转角:右偏 +106.47242697',
        '起点坐标: 2564788.805, 440802.163终点坐标: 2564745.050, 440303.178偏点坐标: 2565288.805, 440602.163计算结果起点距离(垂距): 155.559终点距离（垂距）: 345.341偏移距: 515.559偏转角:右偏 +123.48562888']

    standard1 = [
        '起点坐标: 2564745.050, 440303.178终点坐标: 2565288.805, 440602.163偏点坐标: 2564788.805, 440802.163计算结果起点距离(垂距): 278.762终点距离（垂距）: 341.771偏移距: 416.164偏转角:右偏 +129.23394415',
        '起点坐标: 2565288.805, 440602.163终点坐标: 2564745.050, 440303.178偏点坐标: 2564788.805, 440802.163计算结果起点距离(垂距): 341.771终点距离（垂距）: 278.762偏移距: 416.164偏转角:左偏 +123.48562888',
        '起点坐标: 2564788.805, 440802.163终点坐标: 2565288.805, 440602.163偏点坐标: 2564745.050, 440303.178计算结果起点距离(垂距): 144.693终点距离（垂距）: 393.824偏移距: 479.546偏转角:左偏 +129.23394415']

    for i in range(1, 4):
        # 起点-手动输入
        if (type_name[i - 1] == '手动输入'):
            time.sleep(1)
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_1').send_keys(
                '2564788.805')
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_2').send_keys(
                '440802.163')
            print('起点-手动输入')
        # 起点-定位获取
        if (type_name[i - 1] == '定位获取'):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/StartExternalobtain').click()
            dervier.driver.find_element_by_name('定位获取').click()

            standard = ['2564745.050', '440303.178']
            location = ['1', '2']
            for m in range(2):
                str = dervier.driver.find_element_by_id(
                    'com.southgnss.egstar3:id/textViewCoordinateValue_' + location[m]).text
                if abs(float(str) - float(standard[m])) >= float(standardx[0]):
                    print('起点定位' + show[m] + '数值不一致')
                    print(str + ' ' + standard[m])
            print('起点 - 定位获取')
        # 起点-点库获取
        if (type_name[i - 1] == '点库获取'):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/StartExternalobtain').click()
            dervier.driver.find_element_by_name('点库获取').click()
            dervier.driver.find_element_by_name('起终偏点').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
            print('起点 - 点库获取')
        # 终点-手动输入
        if (1 // i == 0):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_3').send_keys(
                '2564788.805')
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_4').send_keys(
                '440802.163')
            print('终点-手动输入')
            # 偏点-点库获取
            if (type_name[i - 1] == '定位获取'):
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/StartExternalobtain2').click()
                dervier.driver.find_element_by_name('点库获取').click()
                dervier.driver.find_element_by_name('起终偏点').click()
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
                print('偏点-点库获取')
                计算结果(standard[0])
            # 偏点-定位获取
            else:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/StartExternalobtain2').click()
                dervier.driver.find_element_by_name('定位获取').click()
                print('偏点-定位获取')
                计算结果(standard[1])
        # 终点 - 定位获取
        if (1 // i == 1 or (2 - (i // 3)) == 1):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EndExternalobtain').click()
            dervier.driver.find_element_by_name('定位获取').click()
            print('终点 - 定位获取')
            if (type_name[i - 1] == '手动输入'):
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/StartExternalobtain2').click()
                dervier.driver.find_element_by_name('点库获取').click()
                dervier.driver.find_element_by_name('起终偏点').click()
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
                print('偏点-点库获取')
                计算结果(standard[2])
            else:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_5').send_keys(
                    '2564788.805')
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_6').send_keys(
                    '440802.163')
                print('偏点-手动输入')
                计算结果(standard1[1])
        # 终点 - 点库获取
        if ((2 - (i // 3)) == 2):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/EndExternalobtain').click()
            dervier.driver.find_element_by_name('点库获取').click()
            dervier.driver.find_element_by_name('起终偏点').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
            print('终点 - 点库获取')
            if (type_name[i - 1] == '手动输入'):
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/StartExternalobtain2').click()
                time.sleep(1)
                dervier.driver.find_element_by_name('定位获取').click()
                print('偏点-定位获取')
                计算结果(standard1[2])
            else:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_5').send_keys(
                    '2564788.805')
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCoordinateValue_6').send_keys(
                    '440802.163')
                print('偏点-手动输入')
                计算结果(standard1[0])


def 偏点计算():
    point_id = ['textViewCoordinateValue_1', 'textViewCoordinateValue_2', 'textViewCoordinateValue_3',
                'textViewCoordinateValue_4', 'textViewCoordinateValue_5', 'textViewCoordinateValue_6']
    point_data = ['85015.446', '50949.854', '85005.446', '50949.683', '20', '15']

    新建工程('偏点计算')

    # 工具 - 坐标计算 - 偏距计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateCalculate').click()
    坐标定位(450, 850)

    r = 0
    direction = ['左偏', '右偏']
    direction_id = ['rd_type_left', 'rd_type_right']
    extremity_id = ['起点距', '终点距']
    bypoint_id = ['偏距', '偏角', '另一端点距']
    standard = ['起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 84995.192, 50964.510',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 84986.042, 50954.528',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 85001.450, 50964.141',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 85025.187, 50965.023',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 84986.042, 50954.528',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 85001.450, 50964.141',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 84995.705, 50934.514',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 84986.219, 50944.177',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 85001.947, 50935.097',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 85025.700, 50935.027',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 84986.219, 50944.177',
                '起点坐标: 85015.446, 50949.854终点坐标: 85005.446, 50949.683计算结果: 85001.947, 50935.097']

    for m in range(6):
        if m == 3:
            dervier.swipeUp(dervier.driver, 1)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_id[m]).send_keys(point_data[m])
    for n in range(2):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + direction_id[n]).click()
        for p in range(2):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/pointTypeText').click()
            dervier.driver.find_element_by_name(extremity_id[p]).click()
            for q in range(3):
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/PartialPointText').click()
                dervier.driver.find_element_by_name(bypoint_id[q]).click()
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnCalculate').click()
                str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
                str1 = str.replace('\n', '').replace('\r', '')
                if standard[r] == str1:
                    print(direction[n] + ' ' + extremity_id[p] + ' ' + bypoint_id[q] + '计算正确')
                else:
                    print(direction[n] + ' ' + extremity_id[p] + ' ' + bypoint_id[q] + '计算错误')
                    print(str1)
                    print(standard[r])
                r += 1
                dervier.driver.find_element_by_name('数据输入').click()


def 夹角计算():
    新建工程('夹角计算')
    调用Beijing54坐标系统()

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 坐标计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateCalculate').click()
    # 夹角计算
    坐标定位(450, 890)

    point_id = ['TextViewCoordrA1', 'TextViewCoordrA2', 'TextViewCoordrB1', 'TextViewCoordrB2', 'TextViewCoordrC1',
                'TextViewCoordrC2']
    point_data = ['0', '0', '10', '10', '0', '10']

    time.sleep(1)

    for m in range(6):
        if m == 4:
            dervier.swipeUp(dervier.driver, 1)
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + point_id[m]).send_keys(point_data[m])

    # 计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonAverageCaculate').click()

    standard = ['45.00000000', '315.00000000']
    output_id = ['TextViewCoordrCalcResult', 'TextViewCoordrCalcResult2']
    component = ['内角', '外角']
    m = 0
    for m in range(2):
        str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + output_id[m]).text
        if abs(float(standard[m]) - float(str)) >= float(standardx[0]):
            print(component[m] + '错误')
        else:
            print(component[m] + '正确')

    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 角度换算():
    # global standard,str1,str2

    新建工程('角度换算')

    # 点击工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 其它工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemOtherCalculate').click()
    # 角度换算
    坐标定位(450, 628)
    time.sleep(1)
    # 输入参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextUnitValue').send_keys('1.1234')
    # 开始换算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonAngleStartMatrixing').click()

    # 对比数据
    standard = ['64.36607870', '64.21578833']
    str1 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextDegree').text
    str2 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextDegreeOfNimute').text

    if abs(float(standard[0]) - float(str1)) >= float(standardx[0]):
        print('弧度-度错误')
    else:
        print('弧度-度正确')
    if abs(float(standard[1]) - float(str2)) >= float(standardx[0]):
        print('弧度-度分秒错误')
    else:
        print('弧度-度分秒正确')

    # 切换单位：度
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewSeclectUnitShow').click()
    # 选择度
    dervier.driver.find_element_by_name('度').click()
    # 输入参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextUnitValue').send_keys('270.1234')
    # 开始换算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonAngleStartMatrixing').click()

    # 对比数据
    standard = ['4.7145427167', '270.07242400']

    str1 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextRadian').text
    str2 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextDegreeOfNimute').text

    if abs(float(standard[0]) - float(str1)) >= float(standardx[0]):
        print('度-弧度错误')
    else:
        print('度-弧度正确')
    if abs(float(standard[1]) - float(str2)) >= float(standardx[0]):
        print('度-度分秒错误')
    else:
        print('度-度分秒正确')

    # 切换单位：度分秒
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewSeclectUnitShow').click()
    # 选择度分秒
    dervier.driver.find_element_by_name('度分秒').click()

    # 输入参数
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextUnitValue').send_keys('245.4523')

    # 开始换算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonAngleStartMatrixing').click()

    # 对比数据
    standard = ['4.2892581439', '245.75638889']

    str1 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextRadian').text
    str2 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextDegree').text

    if abs(float(standard[0]) - float(str1)) >= float(standardx[0]):
        print('度分秒-弧度错误')
    else:
        print('度分秒-弧度正确')
    if abs(float(standard[1]) - float(str2)) >= float(standardx[0]):
        print('度分秒-度错误')
    else:
        print('度分秒-度正确')

    print('角度换算成功')


def 面积测量():
    global m, n, output, output1, standard
    sendid = ['textViewPointName', 'textViewNoth', 'textViewEath', 'textViewControlCollectValue_3']
    areaid = ['edtName', 'edtCode', 'textViewControlCollectValue_1', 'textViewControlCollectValue_2',
              'textViewControlCollectValue_3']
    area1 = ['面积Aa1', '面积Aa1', '3', '1', '1']
    area2 = ['面积Bb1', '面积Bb1', '7', '1', '1']
    point0 = ['面积Cc1', '3', '5', '1']
    point1 = ['面积Ee1', '1', '1', '1']
    point2 = ['面积Dd1', '1', '5', '1']

    新建工程('面积计算')
    演示模式()
    # -----------坐标管理库添加数据 - 点库获取做准备 - -----------
    # 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    # 坐标管理库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateManager').click()
    m = 0
    n = 0
    for m in range(3):
        # 添加
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        # 输入数据
        for n in range(4):
            if m == 0:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + sendid[n]).send_keys(point0[n])
            if m == 1:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + sendid[n]).send_keys(point1[n])
            if m == 2:
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + sendid[n]).send_keys(point2[n])
        # 确定
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    # 退出坐标管理库
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 点击工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 其它工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemOtherCalculate').click()
    # 面积计算
    坐标定位(450, 660)
    time.sleep(1)
    # 添加
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 定位获取
    dervier.driver.find_element_by_name('定位获取').click()
    # 选择 - 编辑
    list = dervier.driver.find_elements_by_id("com.southgnss.egstar3:id/layoutTextItems")
    list[1].click()
    dervier.driver.find_element_by_name('编辑').click()
    # 修改数据
    m = 0
    for m in range(5):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + areaid[m]).send_keys(area1[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    # 添加
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 手动输入
    dervier.driver.find_element_by_name('手动输入').click()
    # 输入数据
    m = 0
    for m in range(5):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + areaid[m]).send_keys(area2[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    # 添加
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 点库获取
    dervier.driver.find_element_by_name('点库获取').click()
    # 选择点
    dervier.driver.find_element_by_name('面积Cc1').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
    # 计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCalculate').click()

    # 对比结果
    str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
    str1 = str.replace('\n', '').replace('\r', '')
    standard = '面积:8.000m2周长:13.657m'
    if str1 == standard:
        print('面积计算正确')
    else:
        print('面积计算失败')
    # 关闭
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()

    # 获取当前时间
    now = datetime.datetime.now().strftime("%H%M")
    # 保存
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSave').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextExportFileName').send_keys(
        '面积计算' + now)

    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # 多选 - 删除 - 全选 - 删除
    # 添加
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 点库获取
    dervier.driver.find_element_by_name('点库获取').click()
    # 多选
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # 选择点
    dervier.driver.find_element_by_name('面积Dd1').click()
    dervier.driver.find_element_by_name('面积Ee1').click()
    # 导入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barMoreSelectImport').click()
    # / *-------------多选 - 计算 - ------------- * /
    # 多选
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # 计算功能
    dervier.driver.find_element_by_name('面积Bb1').click()
    dervier.driver.find_element_by_name('面积Dd1').click()
    dervier.driver.find_element_by_name('面积Ee1').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barCalculate').click()
    # 对比结果
    output = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
    output1 = output.replace('\n', '').replace('\r', '')
    standard = '面积:12.000m2周长:17.211m'
    if output1 == standard:
        print('多选1面积计算通过')
    else:
        print('多选1面积计算失败')
    # 关闭
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()

    # 取消
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # / *-------------多选 - 选择中间点 - ------------- * /
    # 多选
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # 计算功能
    dervier.driver.find_element_by_name('面积Bb1').click()
    dervier.driver.find_element_by_name('面积Ee1').click()
    # 选择中间点
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barSelectMiddle').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barCalculate').click()
    # 对比结果
    output = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
    output1 = output.replace('\n', '').replace('\r', '')
    standard = '面积:16.000m2周长:17.657m'
    if output1 == standard:
        print('多选2面积计算通过')
    else:
        print('多选2面积计算失败')
    # 关闭
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    # 取消
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # / *-------------多选 - 删除 - ------------- * /
    # 多选
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # 删除功能
    dervier.driver.find_element_by_name('面积Bb1').click()
    dervier.driver.find_element_by_name('面积Cc1').click()
    # 删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # 取消
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    # 删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # / *-------------多选 - 全选 - 删除 - ------------- * /
    # 多选
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    # 全选
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxAll').click()
    # 删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    # / *-----------打开 - ------------- * /
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btOpen').click()
    dervier.driver.find_element_by_name('面积计算' + now + '.dat').click()
    # 确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    # 计算
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btCalculate').click()

    # 对比结果
    output = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
    output1 = output.replace('\n', '').replace('\r', '')
    standard = "面积:8.000m2周长:13.657m"
    if output1 == standard:
        print('打开-面积计算通过')
    else:
        print('打开-面积计算失败')
    # 关闭
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
    # 退出到主界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()
    # 不保存
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()


def 空间距离():
    print('5')
    Spatial = ['1', '2', '3']

    def 定位对比(standard, lei, n):
        for m in range(3):
            str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextStart' + Spatial[m]).text
            if abs(float(str) - float(standard[m])) >= float(standardx[n]):
                print(lei + show[m] + '数值不一致')
                print(str + ' ' + standard[m])
            else:
                print(lei + show[m] + '正确')

    新建工程('空间距离')
    调用Beijing54坐标系统()
    演示模式()

    # 输入 - 坐标管理库
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateManager').click()
    # 添加
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    # 清空 - 输入
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys('起终距离')
    # 选择BLH
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceBLH').click()
    point_id = ['1', '2', '3']
    point_data = ['23.1052', '113.2501', '37.8']
    point1_data = ['23.1053', '113.2501', '37.8']
    for m in range(3):
        dervier.driver.find_element_by_id(
            'com.southgnss.egstar3:id/textViewControlCollectValue_' + point_id[m]).send_keys(
            point_data[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
    # 返回主界面
    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    # 其他工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemOtherCalculate').click()
    # 空间距离
    坐标定位(450, 740)
    time.sleep(1)
    a = ['手动输入', '定位获取', '点库获取']
    for i in range(1, 4):

        if (a[(i - 1)] == '手动输入'):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextStart1').send_keys('23.1053')
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextStart2').send_keys('113.2501')
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextStart3').send_keys('37.8')
            print('起点-手动输入')

        if (a[(i - 1)] == '定位获取'):
            # 起点 - 定位获取
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LengthStartExternalobtain').click()
            # 定位获取
            dervier.driver.find_element_by_name('定位获取').click()

            # 对比数据，保证使用了定位获取功能
            standard = ['23.1053', '113.2501', '37.8']
            定位对比(standard, '起点-定位', 2)

            # 修改起点高程
            for m in range(3):
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextStart' + point_id[m]).send_keys(
                    point_data[m])
            print('起点 - 定位获取')

        if (a[(i - 1)] == '点库获取'):
            # 起点 - 点库获取
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LengthStartExternalobtain').click()
            # 点库获取
            dervier.driver.find_element_by_name('点库获取').click()
            # 选择起终距离
            dervier.driver.find_element_by_name('起终距离').click()
            # 确定
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
            print('起点 - 点库获取')

        # 终点 - 手动输入
        if (1 // i == 0):
            print('终点手动输入')
            for m in range(3):
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextEnd' + point_id[m]).send_keys(
                    point1_data[m])
            if ((i - 1) == 2):
                # 计算
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonAverageCaculate').click()
                # 获取结果，对比
                standard1 = "空间距离:41.895m平面距离:41.898m"
                standard2 = "空间距离:41.895m平面距离:41.897m"

                str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
                str1 = str.replace('\n', '').replace('\r', '')

                if str1 == standard1 or str1 == standard2:
                    print("终点手动计算通过")
                else:
                    print("终点手动计算失败")
                    print("Show", "终点手动计算失败" + "\n" + str1 + "\n" + standard1)
                    print("Show", "终点-手动输入")

        # 终点 - 定位获取
        if (1 // i == 1 or (2 - (i // 3)) == 1):
            print('终点定位获取')
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LengthEndExternalobtain').click()
            # 定位获取
            dervier.driver.find_element_by_name('定位获取').click()

            # 对比数据，保证使用了定位获取功能
            standard = ['23.1053', '113.2501', '37.8']
            定位对比(standard, '终点-定位', 2)

            print('终点-定位获取')

        # 终点 - 点库获取
        if ((2 - (i // 3)) == 2):
            print('终点点库获取')
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/LengthEndExternalobtain').click()
            # 定位获取
            dervier.driver.find_element_by_name('点库获取').click()
            # 选择起终距离
            dervier.driver.find_element_by_name('起终距离').click()
            # 确定
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()

            if ((i - 1) == 0):
                # 计算
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonAverageCaculate').click()
                # 获取结果，对比
                standard1 = "空间距离:30.763m平面距离:30.765m"
                standard2 = "空间距离:30.763m平面距离:30.764m"

                str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewCaculateResult').text
                str1 = str.replace('\n', '').replace('\r', '')

                if str1 == standard1 or str1 == standard2:
                    print("终点 点库计算通过")
                else:
                    print("终点点库计算失败")
                    print("终点点库计算失败" + "\n" + str1 + "\n" + standard1)
                    print('终点-点库获取')


def 土方计算():
    a = ["手动输入", "定位获取", "点库获取"]
    b = ["参考高层", "参考点", "参考面"]
    c = ["textViewNoth", "textViewEath", "textViewControlCollectValue_3"]
    NEH_id = ['textViewNoth', 'textViewEath', 'textViewControlCollectValue_3']
    NEH_data1 = ['1', '5', '15']
    NEH_data2 = ['2', '2', '10']
    NEH_data3 = ['1', '1', '15']
    NEH_data4 = ['6', '1', '15']

    新建工程('土方计算')
    演示模式()

    # 坐标管理库 - 添加点
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarInput').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemCoordinateManager').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys('土方面文件')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceNEH').click()

    for m in range(3):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[m]).send_keys(NEH_data1[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewPointName').send_keys('参考点')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/radioRourceNEH').click()

    for m in range(3):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[m]).send_keys(NEH_data2[m])
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()

    dervier.driver.find_element_by_id('android:id/action_bar_title').click()

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvPopupMenuItemOtherCalculate').click()
    # 土方计算
    坐标定位(450, 820)
    time.sleep(1)

    # 点击面文件
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvSurfaceFileName').click()

    # 面文件添加循环
    for i in range(1, 4):
        # 添加
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        # 面文件手动输入
        if a[(i - 1)] == '手动输入':
            dervier.driver.find_element_by_name('手动输入').click()
            m = 0
            for m in range(3):
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[m]).send_keys(NEH_data3[m])
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
            print(a[(i - 1)])

        # 面文件定位获取
        if a[(i - 1)] == '定位获取':
            # 定位获取
            dervier.driver.find_element_by_name('定位获取').click()
            # 对比数据，保证使用了定位获取功能
            # 选择Pt2
            dervier.driver.find_element_by_name('Pt2').click()
            standard = ['2564745.050', '440303.177', '37.7']
            m = 0
            for m in range(3):
                str1 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[m]).text
                if abs(float(str1) - float(standard[m])) >= float(standardx[0]):
                    print('定位获取-' + show[m] + '数值不一致')
                    print(str1 + ' ' + standard[m])
                else:
                    print('定位获取-' + show[m] + '正确')

            # 修改起点高程
            m = 0
            for m in range(3):
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + NEH_id[m]).send_keys(NEH_data4[m])
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
            print('面文件定位获取-修改成功')

        # 面文件点库获取
        if a[(i - 1)] == '点库获取':
            # 点库获取
            dervier.driver.find_element_by_name('点库获取').click()
            # 选择土方面文件
            dervier.driver.find_element_by_name('土方面文件').click()
            # 确定
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()
            print('面文件点库获取成功')

    time.sleep(1)
    # 先保存在确定
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSave').click()
    # 文件名称
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextExportFileName').send_keys('面文件1')
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
    res = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/message').text
    if res == '文件已经存在,是否覆盖?':
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    # 确定使用
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()

    # 计算
    for i in range(1, 4):
        # 参考高程
        if i == 1:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/edtHigh').send_keys('5')
        # 参考点
        if i == 2:
            p = 2
            # 切换到参考点
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBox' + str(i)).click()
            # 外部获取
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutEarthworkReferenceCoordinate').click()

            if a[(p - 1)] == '定位获取':
                # 定位获取
                dervier.driver.find_element_by_name('定位获取').click()

                # 计算结果
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnCalculate').click()

                element = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/custom')
                str1 = element.find_element_by_class_name('android.widget.TextView').text
                str2 = str1.replace('\n', '').replace('\r', '')

                if a[(p - 1)] == '定位获取':
                    standard1 = '挖方: 0.000(m³)填方: 227.000(m³)地表面积: 10.000(m²)'
                    standard2 = '挖方: 0.000(m³)填方: 228.000(m³)地表面积: 10.000(m²)'

                if str2 == standard1 or str2 == standard2:
                    print(b[i - 1] + a[(p - 1)] + '计算通过')
                    dervier.driver.tap([(100, 100)])

                else:
                    print(b[i - 1] + a[(p - 1)] + '计算失败' + '\n' + str1 + '\n' + standard1)
                    dervier.driver.tap([(100, 100)])

                if a[(p)] == '点库获取':
                    # 外部获取
                    dervier.driver.find_element_by_id(
                        'com.southgnss.egstar3:id/layoutEarthworkReferenceCoordinate').click()
                    # 点库获取
                    dervier.driver.find_element_by_name('点库获取').click()
                    # 选择参考点 - 确定
                    dervier.driver.find_element_by_name('参考点').click()
                    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btSure').click()

        # 参考面
        if i == 3:
            # 切换到参考面
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBox' + str(i)).click()
            # 进入参考面
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/tvReferenceSurfaceFileName').click()
            # 清空数据                   多选 - 全选 - 删除 - 确定
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxAll').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
            m = 0
            for m in range(3):
                # 添加
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
                dervier.driver.find_element_by_name('手动输入').click()

                NEH = [['2', '2', '5'], ['4', '2', '5'], ['2', '3', '5']]

                n = 0
                for n in range(3):
                    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + c[n]).send_keys(NEH[m][n])
                dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btComplete').click()
            # 先保存在确定
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSave').click()
            # 文件名称
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/editTextExportFileName').send_keys('面文件2')
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()
            # 确定使用
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnSure').click()

        # 计算结果
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btnCalculate').click()
        element = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/custom')
        str1 = element.find_element_by_class_name('android.widget.TextView').text
        str2 = str1.replace('\n', '').replace('\r', '')

        # 参考高程的结果
        if i == 1:
            standard1 = '挖方: 100.000(m³)填方: 0.000(m³)地表面积: 10.000(m²)'

        # 参考点-点库获取的结果
        if i == 2:
            if a[(p)] == '点库获取':
                standard1 = '挖方: 50.000(m³)填方: 0.000(m³)地表面积: 10.000(m²)'

        # 参考面的结果
        if i == 3:
            standard1 = '挖方: 10.000(m³)填方: 0.000(m³)地表面积: 1.000(m²)'

        if str2 == standard1:
            print(b[i - 1] + '计算通过')
            dervier.driver.tap([(100, 100)])
        else:
            print(b[i - 1] + '计算失败' + '\n' + str1 + '\n' + standard1)
            dervier.driver.tap([(100, 100)])

    dervier.driver.find_element_by_id('android:id/action_bar_title').click()


def 编码集():
    print('编码集')

    # 工具
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/layoutMainUIToolBarTools').click()
    dervier.driver.find_element_by_name('编码集').click()

    # 多选-删除 - 全选 - 删除
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    dervier.driver.find_element_by_name('林地').click()
    dervier.driver.find_element_by_name('河边').click()
    dervier.driver.find_element_by_name('护栏边').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    str = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewShowNumsRecord').text
    standard = '共20条'
    if str == standard:
        print('多选删除成功')
    else:
        print('多选删除失败')

    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewEdit').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/checkBoxAll').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/barRemove').click()
    dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()
    str1 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewShowNumsRecord').text
    standard = '共0条'
    if str1 == standard:
        print('全选删除成功')
    else:
        print('全选删除失败')

    # 添加
    code_id = ['edtName', 'edtDescription']
    code_data = [['测试', '测试'], ['ABC', 'ABS'], ['qwer', 'tyui'], ['中文abDSD', '中文sdSHD'], ['ds', 'ss']]
    for m in range(5):
        dervier.driver.find_element_by_id('com.southgnss.egstar3:id/btAdd').click()
        for n in range(2):
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/' + code_id[n]).send_keys(code_data[m][n])
        if m == 4:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonNo').click()
        else:
            dervier.driver.find_element_by_id('com.southgnss.egstar3:id/buttonYes').click()

    str2 = dervier.driver.find_element_by_id('com.southgnss.egstar3:id/textViewShowNumsRecord').text
    standard = '共4条'
    if str2 == standard:
        print('添加成功')
    else:
        print('添加失败')

    dervier.driver.find_element_by_id('android:id/action_bar_title').click()




坐标管理库()
dervier.driver.quit()
